#include "data_struct/base/LogBase.h"
#include <boost/date_time/posix_time/posix_time.hpp>
#include <iostream>
#include "lib/Time.h"

namespace behavior_controller
{

    StdoutLogger::StdoutLogger(std::string name, LogLevel lvl)
        : LogBase(name, "stdout", lvl)
    {
    }

    void StdoutLogger::Flush() const { std::cout.flush(); }

    void StdoutLogger::ErrorLog(const std::string &log) const
    {
        std::cout << "\033[31m"
                  << "[error]" << '['
                  << Time::Text() << "]" << log
                  << "\033[0m" << std::endl;
    }

    void StdoutLogger::WarnLog(const std::string &log) const
    {
        std::cout << "\033[33m"
                  << "[warn] " << '['
                  << Time::Text() << "]" << log
                  << "\033[0m" << std::endl;
    }

    void StdoutLogger::InfoLog(const std::string &log) const
    {
        std::cout << "\033[32m"
                  << "[info] " << '['
                  << Time::Text() << "]" << log
                  << "\033[0m" << std::endl;
    }

    void StdoutLogger::DebugLog(const std::string &log) const
    {
        std::cout << "\033[0m"
                  << "[debug]" << '['
                  << Time::Text() << "]" << log
                  << "\033[0m" << std::endl;
    }

} // namespace behavior_controller